home *** CD-ROM | disk | FTP | other *** search
/ Aminet 23 / Aminet 23 (1998)(GTI - Schatztruhe)[!][Feb 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / Asm / Fading / GreenFade.s next >
Text File  |  1997-12-10  |  4KB  |  129 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;Name:      Green Fade
  3. ;Author:    Paul Manias
  4. ;Copyright: DreamWorld Productions (c) 1996-1997.  Freely distributable.
  5. ;
  6. ;Fades in a 32 colour picture, then up to a specified colour (greenish
  7. ;yellow), and then out to black.  Press left mouse button to exit.
  8.  
  9.     INCDIR    "INCLUDES:"
  10.     INCLUDE    "dpkernel/dpkernel.i"
  11.  
  12.     SECTION    "Demo",CODE
  13.  
  14. ;===========================================================================;
  15. ;                             INITIALISE DEMO
  16. ;===========================================================================;
  17.  
  18.     STARTDPK
  19.  
  20. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  21.     move.l    DPKBase(pc),a6
  22.     lea    FilePic(pc),a0
  23.     moveq    #ID_PICTURE,d0
  24.     CALL    Load
  25.     move.l    d0,Picture
  26.     beq.s    .Exit
  27.  
  28.     moveq    #ID_SCREEN,d0
  29.     CALL    Get
  30.     move.l    d0,Screen
  31.     beq.s    .Exit
  32.  
  33.     move.l    Picture(pc),a0
  34.     move.l    Screen(pc),a1
  35.     move.l    PIC_Bitmap(a0),a2
  36.     move.l    BMP_Data(a2),GS_MemPtr1(a1)
  37.     CALL    CopyStructure
  38.  
  39.     move.l    Screen(pc),a0
  40.     clr.l    GS_Palette(a0)
  41.     move.l    #BLANKPALETTE,GS_Attrib(a0)
  42.     sub.l    a1,a1
  43.     CALL    Init
  44.     tst.l    d0
  45.     beq.s    .Exit
  46.  
  47.     move.l    Screen(pc),a0
  48.     CALL    Display
  49.  
  50.     bsr.s    Main
  51.  
  52. .Exit    move.l    DPKBase(pc),a6
  53.     move.l    Screen(pc),a0
  54.     CALL    Free
  55.     move.l    Picture(pc),a0
  56.     CALL    Free
  57.     MOVEM.L    (SP)+,A0-A6/D1-D7
  58.     moveq    #ERR_OK,d0
  59.     rts
  60.  
  61. ;===========================================================================;
  62. ;                                MAIN CODE
  63. ;===========================================================================;
  64.  
  65. Main:    moveq    #$00,d7    ;d7 = FadeState
  66.     move.l    Screen(pc),a0    ;a0 = Screen
  67.     move.l    GS_Bitmap(a0),a5
  68.  
  69.     move.l    SCRBase(pc),a6
  70. .f_in    CALL    scrWaitAVBL
  71.     move.l    Screen(pc),a0    ;a0 = Screen
  72.     moveq    #5,d1    ;d1 = Speed of fade.
  73.     move.l    Picture(pc),a1    ;a1 = Picture structure.
  74.     move.l    PIC_Palette(a1),a1    ;a1 = Palette to fade to.
  75.     addq.w    #8,a1
  76.     moveq    #$000000,d2    ;d2 = Fading from black.
  77.     moveq    #00,d3    ;d3 = Start colour.
  78.     move.l    BMP_AmtColours(a5),d4    ;d4 = Amount of colours.
  79.     move.w    d7,d0
  80.     CALL    scrColourToPalette    ;Do the fade routine.
  81.     move.w    d0,d7    ;Has the fade finished yet?
  82.     bne.s    .f_in    ;If not, keep doing it.
  83.  
  84.     moveq    #$00,d7    ;d7 = FadeState
  85. .f_mid    CALL    scrWaitAVBL
  86.     move.l    Screen(pc),a0    ;a0 = Screen
  87.     moveq    #2,d1    ;d1 = Speed of fade.
  88.     move.l    Picture(pc),a1    ;a1 = Picture structure.
  89.     move.l    PIC_Palette(a1),a1    ;a1 = Palette we are fading from.
  90.     addq.w    #8,a1
  91.     move.l    #$75F343,d2    ;d2 = Colour we are fading to.
  92.     move.w    d7,d0
  93.     CALL    scrPaletteToColour    ;Do the fade routine.
  94.     move.w    d0,d7    ;Has the fade finished yet?
  95.     bne.s    .f_mid    ;If not, keep doing it.
  96.  
  97.     moveq    #$00,d7
  98. .f_out    CALL    scrWaitAVBL
  99.     move.l    Screen(pc),a0    ;a0 = Screen
  100.     move.l    Picture(pc),a1    ;a1 = Picture structure.
  101.     move.l    PIC_Palette(a1),a1    ;a1 = Palette we are fading from.
  102.     addq.w    #8,a1
  103.     moveq    #2,d1    ;d1 = Speed of fade.
  104.     move.l    #$a5F343,d2    ;d2 = Colour.
  105.     moveq    #$000000,d5    ;d5 = Colour.
  106.     move.w    d7,d0
  107.     CALL    scrColourMorph    ;Do the fade routine.
  108.     move.w    d0,d7    ;Has the fade finished yet?
  109.     bne.s    .f_out    ;If not, keep doing it.
  110.     rts
  111.  
  112. ;===========================================================================;
  113. ;                                  DATA
  114. ;===========================================================================;
  115.  
  116. Screen:        dc.l  0
  117. Picture:    dc.l  0
  118. FilePic:    FILENAME "GMS:demos/data/PIC.Loading"
  119.  
  120. ;===========================================================================;
  121.  
  122. ProgName:    dc.b  "Green Fade",0
  123. ProgAuthor:    dc.b  "Paul Manias",0
  124. ProgDate:    dc.b  "10 December 1997",0
  125. ProgCopyright:    dc.b  "DreamWorld Productions (c) 1996-1997.  Freely distributable.",0
  126. ProgShort:    dc.b  "Fading demonstration.",0
  127.         even
  128.  
  129.